package com.hsu.yupao.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hsu.yupao.model.domain.Chat;
import com.hsu.yupao.model.domain.User;
import com.hsu.yupao.model.request.ChatRequest;
import com.hsu.yupao.model.vo.MessageVO;

import java.util.Date;
import java.util.List;

/**
* @author 幽琴健
* @description 针对表【chat(聊天信息表)】的数据库操作Service
* @createDate 2024-06-03 16:48:19
*/
public interface ChatService extends IService<Chat> {

    /**
     * 获取私聊聊天内容
     * @param chatRequest
     * @param chatType
     * @param loginUser
     * @return
     */
    List<MessageVO> getPrivateChat(ChatRequest chatRequest, int chatType, User loginUser);

    /**
     * 获取队伍聊天内容
     * @param chatRequest
     * @param chatType
     * @param loginUser
     * @return
     */
    List<MessageVO> getTeamChat(ChatRequest chatRequest, int chatType, User loginUser);

    /**
     * 获取大厅聊天纪录
     * @param chatType
     * @param loginUser
     * @return
     */
    List<MessageVO> getHallChat(int chatType, User loginUser);

    /**
     * 保存缓存
     * @param redisKey
     * @param id
     * @param messageVos
     */
    void saveCache(String redisKey, String id, List<MessageVO> messageVos);

    /**
     * 获取缓存
     * @param redisKey
     * @param id
     * @return
     */
    List<MessageVO> getCache(String redisKey, String id);

    /**
     * 聊天记录映射
     * @param fromId
     * @param toId
     * @param text
     * @param chatType
     * @param createTime
     * @return
     */
    MessageVO chatResult(Long fromId, Long toId, String text, Integer chatType, Date createTime);

    /**
     * 删除缓存中的键
     * @param key
     * @param id
     */
    void deleteKey(String key, String id);

}
